home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
075 - Clash of Arms.dsk
/
NEW.ARMY.S
< prev
next >
Wrap
Text File
|
2019-02-17
|
9KB
|
246 lines
public viewmap
on nocar goto link.term
gosub home
ch$=pc$
open #1,"h:war.map1":open #2,"h:war.map2"
gosub scanmap
nc=kc
close #1:open #1,"H:COORDS"
position #1,8,0:input #1 ky,ky
if ky<24 ma=0:mp=0:bo=24:yy=1:yo=1:else mp=1:bo=47:yy=24:yo=24:ma=1
close
open #1,"h:war.map1":open #2,"h:war.map2"
xx=1:xo=1
ch$=pc$:kc=0
te=1
gosub printmap
na=0
nn=ab
placearmy
x=xx:y=yy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
gosub readcoords
if ma<>mp ma=mp:gosub printmap
x=xx:y=yy:gosub getline1:gosub screen
gosub invon:print mid$(l1$,xx,1);:gosub invoff
x=xx:y=yy:gosub armystrength
x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
x=18:y=bo:gosub screen:print"Army "na+1"("nn"): < > Change City, (1-9) Place Army, (ESC) abort";
gosub getkey
if (ka$=">") or (ka$=".") ka=1:else ka=0
if (ka$="<") or (ka$=",") kb=1:else kb=0
if ((ka=1) and (kc<nc)) kc=kc+1:goto placearmy
if ((kb=1) and (kc>0)) kc=kc-1:goto placearmy
if ka$=chr$(27) gosub home:link "a:war.start","fromnew"
if not(val(ka$)) goto placearmy
ka=val(ka$):if ka=0 goto placearmy
if ka+ar>9 x=18:y=bo:gosub screen:print "No more than nine armies per stack. Press a key ";:gosub getkey:goto placearmy
if na+ka>nn x=18:y=bo:gosub screen:print "You don't have that many armies. Press a key ";:gosub getkey:goto placearmy
gosub newarmies
goto placearmy
viewmap
on nocar goto link.term
ma=0:bo=24
open #1,"h:war.map1":open #2,"h:war.map2"
gosub home
xx=1:yy=1:xo=1:yo=1
te=0
gosub printmap
ch$=pc$
nn=ab
x=xx:y=yy:gosub getline1:gosub screen
gosub invon:print mid$(l1$,xx,1);:gosub invoff
x=40:y=bo:gosub screen:print "Explore Map. Press <cr> to exit.";
gosub mapmove
gosub home
link "a:war.start","maincommand"
NewArmies
ar=ar+ka
b$=chr$(ar+48)
position #2,80,yy-1,xx-1
print #2,b$ ;
x=xx:y=yy:gosub getline1:gosub armystrength
x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
ab=ab-ka:na=na+ka:if na<nn return
x=xx:y=yy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
gosub home
link "a:war.start","fromnew"
map0
if ((ka$="8") or (ka$='W')) and (yy<>1) yy=yy-1:gosub erase
if ((ka$="2") or (ka$='X')) and (yy<23) yy=yy+1:gosub erase
return
map1
if ((ka$="8") or (ka$='W')) and (yy<>24) yy=yy-1:gosub erase
if ((ka$="2") or (ka$='X')) and (yy<46) yy=yy+1:gosub erase
return
getkey
ka=key(0):if ka=0 goto getkey
ka$=chr$(ka)
if asc(ka$)>96 ka$=chr$(asc(ka$)-32)
poke 99,0:poke 100,0
return
map2
if (ka$="K") and (xx<70) xx=xx+10:gosub erase:goto mapmv2
if (ka$="J") and (xx>10) xx=xx-10:gosub erase:goto mapmv2
if (ka$="I") and (yy>29) and (ma=1) yy=yy-5:gosub erase:goto mapmv2
if (ka$="I") and (yy>6) and (ma=0) yy=yy-5:gosub erase:goto mapmv2
if (ka$="M") and (yy<18) and (ma=0) yy=yy+5:gosub erase:goto mapmv2
if (ka$="M") and (yy<41) and (ma=1) yy=yy+5:gosub erase:goto mapmv2
if (ka$="I") and (ma=1) ka$="8":yy=24:goto map3
if (ka$="M") and (ma=0) ka$="2":yy=23:goto map3
mapmove
gosub getkey
if instr(ka$,"IJKM") goto map2
map3
if instr(ka$,"147QAZ") ml=1:else ml=0
if instr(ka$,"369CDE") mr=1:else mr=0
if (ml) and (xx<>1) xx=xx-1:gosub erase
if (mr) and (xx<79) xx=xx+1:gosub erase
if instr(ka$,"QE79") ka$="8":else if instr(ka$,"ZC13") ka$="2"
if ((ka$="8") or (ka$='W')) and (yy=24) and (ma=1) ma=0:bo=24:yy=23:gosub printmap:xo=xx:yo=yy:goto mapmv2
if ((ka$="2") or (ka$='X')) and (yy=23) and (ma=0) ma=1:bo=47:yy=24:gosub printmap:xo=xx:yo=yy:goto mapmv2
if ma=0 gosub map0:else gosub map1
mapmv2
if ka$=chr$(27) return
if ka$=chr$(13) return
if instr(ka$," YN5") return
y=yy:gosub getline1
x=xx:y=yy:gosub screen:gosub invon:print mid$(l1$,xx,1);chr$(8);:gosub invoff
if ok ok=0:return
if instr(mid$(l1$,xx,1),"ABCDEF") x=9:y=bo:gosub screen:gosub armystrength:print ar;" ";:else if ar<>0 x=9:y=bo:gosub screen:print "0";:ar=0
if mid$(l1$,xx,1)<>tr$ gosub getterrain:x=24:y=bo:gosub screen:print ms$;
goto mapmove
getterrain
a$=mid$(l1$,xx,1):if instr(a$,"ABCDEF") am=1:else am=0
y=yy:gosub getline2:b$=mid$(l2$,xx,1)
if a$="#" ms$="Impassable"
if a$=" " ms$="Land "
if a$=":" ms$="Water "
if a$="+" ms$="Empty Boat"
if a$="=" ms$="Deep Water"
if a$="*" ms$="City "
if (am) and (asc(a$)>96) and (asc(b$)<65) ms$="Army "
if (asc(a$)>96) and (am) and (asc(b$)>64) ms$="Army/Boat "
if (asc(a$)>64) and (asc(a$)<91) ms$="Army/City "
tr$=a$
return
armystrength
y=yy:gosub getline2
a$=mid$(l2$,xx,1)
if instr(a$,"0123456789") ar=val(a$):return
if instr(a$,"ABCDEFGHI") ar=asc(a$)-64:return
ar=0:return
;
; Scan the map for character CH$ and records coordinates in H:COORDS
;
ScanMap
x=40:y=bo:gosub screen
print \"Wait..scanning map... ";
kill "H:COORDS":create "H:COORDS"
kc=0:kb=0:if (asc(ch$)>96) and (asc(ch$)<123) kb=1:kb$=chr$(asc(ch$)-32)
for y = 2 to 45
gosub getline1:gosub getline2
ka=instr(ch$,l1$)
if not ka goto PastCheck
for x = ka to 79
ka$=mid$(l1$,x,1)
if kb and (ka$=kb$) then gosub FoundMatch
next
PastCheck
next:return
FoundMatch
close #1:open #1,"H:COORDS"
position #1,8,kc:print #1 x,y
position #1,8,kc+1:print #1 0,0
close #1:open #1,"H:WAR.MAP1"
kc=kc+1
return
;
; Read coordinates from "H:COORDS" and calls Move routine
; Make sure KC=0 before calling, and don't use KC in move routine
;
ReadCoords
close #1:open #1,"H:COORDS"
position #1,8,kc:input #1 kx,ky
close #1:open #1,"H:WAR.MAP1"
if (kx=0) and (ky=0) kc=kc-1:return
xx=kx:yy=ky
if yy<24 mp=0:bo=24:else mp=1:bo=47
return
erase
y=yo:gosub getline1
a$=mid$(l1$,xo,1)
x=xo:y=yo:gosub screen
print a$ ;
xo=xx:yo=yy
return
printmap
gosub home
if ma=0 fn=1:else fn=24
for y=fn to fn+22
gosub getline1
print l1$
next
x=xx:y=yy:gosub getline1:gosub armystrength
x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
if te<>1 x=15:gosub screen:print "Terrain: ";ms$;
return
Screen
if ma=0 ve=y:else ve=y-23
print #3 chr$(30);chr$(31+x);chr$(31+ve);
if (pt) or ((pt=0) and (an=0)) print #4 chr$(30);chr$(31+x);chr$(31+ve);
if AN print #4 chr$(27); "["; ve; ";"; x; "f";
return
InvOn
print #3 chr$(15);
if (pt) or ((pt=0) and (an=0)) print #4 chr$(15);
if an print #4 chr$(27);"[1m";
return
InvOff
print #3 chr$(14);
if (pt) or ((pt=0) and (an=0)) print #4 chr$(14);
if an print #4 chr$(27);"[0m";
return
Home
print #3 chr$(12);
if (pt) or ((pt=0) and (an=0)) print #4 chr$(12);
if an print #4 chr$(27);"[H";chr$(27);"[J";
return
rndm
zl$=rnd$
zl=((random(10000)+100)/100):if zl>100 then zl=zl-1
return
getline1
position #1,80,y-1
input #1,l1$
return
getline2
position #2,80,y-1
input #2,l2$
return
link.term
link "a:war.start","termgame"